import { ref } from "vue";
import { defineStore } from "pinia";
export const useChatStore = defineStore(
  "chatStore",
  () => {
    const chatList = ref([]);
    const getChatList = () => {
      return chatList.value;
    };
    const setChatList = (data) => {
      chatList.value = data;
    };

    const removeChatList = () => {
      chatList.value = [];
    };
    const chat = ref(null);
    const getChat = () => {
      return chat.value;
    };
    const setChat = (data) => {
      chat.value = data;
    };
    const removeChat = () => {
      chat.value = null;
    };
    return {
      chat,
      getChat,
      setChat,
      chatList,
      getChatList,
      setChatList,
      removeChatList,
      removeChat,
    };
  },
  {
    persist: true,
  }
);
